//
//  DeviceAttributeViewController.m
//  upnpxdemo
//
//  Created by 赵帅 on 13-9-1.
//  Copyright (c) 2013年 wiimu.inc. All rights reserved.
//

#import "DeviceAttributeViewController.h"

@interface DeviceAttributeViewController ()

@end

@implementation DeviceAttributeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - navigation methods
-(NSString *)navigationBarTitle
{
    return [[GlobalInfo sharedInstance].currentSelectedUpnPInfo objectForKey:@"ssid"];
}

-(BOOL)isNewVersionButtonEnabled
{
    return YES;
}


#pragma mark -
#pragma mark UITableView Delegate & Datasource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    // Configure the cell.
    
    NSDictionary * dic = [GlobalInfo sharedInstance].currentSelectedUpnPInfo;
    
    switch (indexPath.row) {
        case 0:
            cell.textLabel.text = [NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"NAME",@""),[dic objectForKey:@"ssid"]];
            break;
        case 1:
            cell.textLabel.text = [NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"VERSION",@""),[dic objectForKey:@"firmware"]];
            break;
        case 3:
            cell.textLabel.text = [NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"IPADDRESS",@""),[dic objectForKey:@"apcli0"]];
            break;
        default:
            break;
    }
    
    if(indexPath.row == 2)
    {
        cell.textLabel.text = @"uuid:";
        UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(55, 5, 240, 35)];
        label.font = [UIFont boldSystemFontOfSize:12];
        label.backgroundColor = [UIColor clearColor];
        label.text = [dic objectForKey:@"uuid"];
        [cell.contentView addSubview:label];
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

@end
